Format Xen-API error messages nicely.
authorEwan Mellor <ewan@xensource.com>
Thu, 28 Dec 2006 15:52:31 +0000 (15:52 +0000)
committerEwan Mellor <ewan@xensource.com>
Thu, 28 Dec 2006 15:52:31 +0000 (15:52 +0000)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xm/main.py

index 5f27680a5e5122ece8398182093a2f1b8ce11bcf..3feb864f16358efb6b8df72ad57a35a2df59d846 100644 (file)
@@ -1780,7 +1780,8 @@ def _run_cmd(cmd, cmd_name, args):
     except SystemExit, code:
         return code == 0, code
     except XenAPI.Failure, exn:
-        print >>sys.stderr, str(exn)
+        for line in [''] + wrap(str(exn), 80) + ['']:
+            print >>sys.stderr, line
     except xmlrpclib.Fault, ex:
         if ex.faultCode == XendClient.ERROR_INVALID_DOMAIN:
             err("Domain '%s' does not exist." % ex.faultString)